#include "common.hpp"

int main()
{
    // cout << "I am client" << endl;
    int wfd = open(PATH, O_WRONLY);
    if(wfd < 0)
    {
        cout << "open filed, errno: " << errno << ", error_string: " << strerror(errno) << endl;
        return 1;
    }
    int cnt = 10;
    char wbuff[1024];
    string s;
    while(cnt)
    {
        cin >> s;
        if(s == "quit") break;
        snprintf(wbuff, sizeof(wbuff) - 1, "%s", s.c_str());
        write(wfd, wbuff, strlen(wbuff));
        cnt--;
    }
    return 0;
}